package com.falcon.ribbon.ctrl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestRibbonCtrl {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private LoadBalancerClient loadBalancerClient;

    @GetMapping("/ribbon/test")
    public String test(String name){
        return "hi " + name;
    }

    @GetMapping("/ribbonTest")
    public String findById() {
        System.out.println("tttt.....");
        return this.restTemplate.getForObject("http://customer-service/testApi", String.class);
    }
}
